<button class="layui-btn layui-btn-sm" onclick="eova_flow_create()">
	<i class="layui-icon  ${button.icon!}"></i> ${button.name!}
</button>
<script type="text/javascript">
var eova_flow_create = function() {
	
	var node = singletree.selectNode;
	
	// 默认新增到根下
	var menuId = 0;
	if (node) {
		menuId = node[singletree.idField];
	}
	
	var url = '/menu/flow?parent_id=' + menuId;

	if(menuId == 0){
		layer.confirm('也可主动选择一个指定目录进行添加!', {
			title : '未选择父目录, 确认添加到根目录下?',
			icon : 3,
			btn : [ '确定', '取消' ]
		}, function(i) {
			add(url);
			layer.close(i);
		});
		return;
	}
	add(url);
	
	function add(url){
    	dialog(function(){
    		location.reload();
    	}, '创建工作流', url , 700, 0.8);
	}
};
</script>